<?php

namespace qore_base\web;
use \qore\base\Component;
use \qore\error\Exception;
use \Qore;

class HttpRequest extends Component {
	protected $_requestUri;
	
	public function getRequestUri() { return $this->_requestUri ?: $this->_requestUri = $this->_getRequestUri(); }
	protected function _getRequestUri() {
		// IIS
		if (isset($_SERVER['HTTP_X_REWRITE_URL'])) return $_SERVER['HTTP_X_REWRITE_URL'];
		
		if (isset($_SERVER['REQUEST_URI'])) return $_SERVER['REQUEST_URI'];
		
		throw new Exception(Qore::t('qore', 'CHttpRequest is unable to determine the request URI.'));
	}

}
